package com.ruoyi.car.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.car.mapper.CarOwnerMapper;
import com.ruoyi.car.domain.CarOwner;
import com.ruoyi.car.service.ICarOwnerService;
import com.ruoyi.common.core.text.Convert;

/**
 * 车主信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-05-11
 */
@Service
public class CarOwnerServiceImpl implements ICarOwnerService 
{
    @Autowired
    private CarOwnerMapper carOwnerMapper;

    /**
     * 查询车主信息
     * 
     * @param ownerId 车主信息ID
     * @return 车主信息
     */
    @Override
    public CarOwner selectCarOwnerById(Long ownerId)
    {
        return carOwnerMapper.selectCarOwnerById(ownerId);
    }

    /**
     * 查询车主信息列表
     * 
     * @param carOwner 车主信息
     * @return 车主信息
     */
    @Override
    public List<CarOwner> selectCarOwnerList(CarOwner carOwner)
    {
        return carOwnerMapper.selectCarOwnerList(carOwner);
    }

    /**
     * 新增车主信息
     * 
     * @param carOwner 车主信息
     * @return 结果
     */
    @Override
    public int insertCarOwner(CarOwner carOwner)
    {
        carOwner.setCreateTime(DateUtils.getNowDate());
        return carOwnerMapper.insertCarOwner(carOwner);
    }

    /**
     * 修改车主信息
     * 
     * @param carOwner 车主信息
     * @return 结果
     */
    @Override
    public int updateCarOwner(CarOwner carOwner)
    {
        carOwner.setUpdateTime(DateUtils.getNowDate());
        return carOwnerMapper.updateCarOwner(carOwner);
    }

    /**
     * 删除车主信息对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCarOwnerByIds(String ids)
    {
        return carOwnerMapper.deleteCarOwnerByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除车主信息信息
     * 
     * @param ownerId 车主信息ID
     * @return 结果
     */
    @Override
    public int deleteCarOwnerById(Long ownerId)
    {
        return carOwnerMapper.deleteCarOwnerById(ownerId);
    }
}
